/**
 * Bugreport Window
 * 
 * This plugins adds a bug report window to the timemachine
 * 
 * @author flobo <bosselmann@gmail.com>
 * 
 */
var plugin_bugreport = {
	_showTopbar: function() {
		$('topbar').innerHTML += '<div> | </div><div style="background-image:url(plugins/bugreport/bug.gif); height:15px; width:15px; margin-top:6px;" id="bugreport"></div>';
		$('bugreport').onclick = function () {
			var win = new Modal({
				width:400,
				height:400
			});
			
			j.request('bugreport:loadWindow','',function(res) {
				$('floating_content').innerHTML = res;
				
				$('br_submit').onclick=function() {
					$('br_status').innerHTML = 'sending ...';
					joel.request('bugreport:submit',{
						type:$('br_type').value,
						report:$('br_report').value
						
					},function (res) {
						if(res) {
							$('br_status').innerHTML = res;
						} else {
							$('br_status').innerHTML = 'thank you.';
							setTimeout(function() { win.close(); },2000);
						}
					});
				}
			});
		}
	}
};